home *** CD-ROM | disk | FTP | other *** search
/ The Complete Utilities To…ka 501 Killer Utilities! / 501 Killer Utilities! (Macworld July 1995).cdr / Programming / metro-c-cpp-121 / C_C++_1.2.1 / INTO ‘Headers’ / INTO ‘Universal Headers’ / ConditionalMacros.h < prev    next >
Encoding:
C/C++ Source or Header  |  1995-01-25  |  6.7 KB  |  218 lines  |  [TEXT/MPS ]

  1. /*
  2.      File:        ConditionalMacros.h
  3.  
  4.      Copyright:    © 1984-1994 by Apple Computer, Inc.
  5.                  All rights reserved.
  6.  
  7.      Version:    Universal Interfaces 2.0a4 Wednesday, January 25, 1995. 
  8.  
  9.      Bugs?:        If you find a problem with this file, send the file and version
  10.                  information (from above) and the problem description to:
  11.  
  12.                      Internet:    apple.bugs@applelink.apple.com
  13.                      AppleLink:    APPLE.BUGS
  14.  
  15. */
  16.  
  17. #ifndef __CONDITIONALMACROS__
  18. #define __CONDITIONALMACROS__
  19.  
  20.  
  21. #ifdef __cplusplus
  22. extern "C" {
  23. #endif
  24.  
  25.  
  26. #ifdef __CFM68K__
  27. #pragma lib_export on
  28. #endif
  29.  
  30. /*
  31.     This file sets up the following compiler independent conditionals:
  32.     
  33.     GENERATINGPOWERPC        - Compiler is generating PowerPC instructions
  34.     GENERATING68K            - Compiler is generating 68k family instructions
  35.     GENERATING68881            - Compiler is generating mc68881 floating point instructions
  36.     GENERATINGCFM            - Code being generated assumes CFM calling conventions
  37.     CFMSYSTEMCALLS            - No A-traps.  Systems calls are made using CFM and UPP's
  38.     
  39.     SystemSevenFiveOrLater    - Compiled code will only be run on a System 7.5 or later Macintosh
  40.     SystemSevenOrLater        - Compiled code will only be run on a System 7.0 or later Macintosh
  41.     SystemSixOrLater        - Compiled code will only be run on a System 6.0 or later Macintosh
  42.                               A developer should set the appropriate flag on the compiler command-
  43.                               line or in a file processed before this file.  This will allow the
  44.                               certain optimizations to be made which can result in smaller, faster
  45.                               applications.
  46.     
  47.     CGLUESUPPORTED            - Interface library will support "C glue" functions (function names
  48.                               are: all lowercase, use C strings instead of pascal strings, use 
  49.                               Point* instead of Point).
  50.  
  51.     OLDROUTINENAMES            - "Old" names for Macintosh system calls are allowed in source code.
  52.                               (e.g. DisposPtr instead of DisposePtr). The names of system routine
  53.                               are now more sensitive to change because CFM binds by name.  In the 
  54.                               past, system routine names were compiled out to just an A-Trap.  
  55.                               Macros have been added that each map an old name to its new name.  
  56.                               This allows old routine names to be used in existing source files,
  57.                               but the macros only work if OLDROUTINENAMES is true.  This support
  58.                               will be removed in the near future.  Thus, all source code should 
  59.                               be changed to use the new names! You can set OLDROUTINENAMES to false
  60.                               to see if your code has any old names left in it.
  61.     
  62.     OLDROUTINELOCATIONS     - "Old" location of Macintosh system calls are used.  For example, c2pstr 
  63.                               has been moved from Strings to TextUtils.  It is conditionalized in
  64.                               Strings with OLDROUTINELOCATIONS and in TextUtils with !OLDROUTINELOCATIONS.
  65.                               This allows developers to upgrade to newer interface files without suddenly
  66.                               all their code not compiling becuase of "incorrect" includes.  But, it
  67.                               allows the slow migration of system calls to more understandable file
  68.                               locations.  OLDROUTINELOCATIONS currently defaults to true, but eventually
  69.                               will default to false.
  70.     
  71.     
  72.     There are some invariants among the conditionals:
  73.     
  74.     GENERATINGPOWERPC != GENERATING68K
  75.     GENERATING68881 => GENERATING68K
  76.     GENERATINGPOWERPC => GENERATINGCFM
  77.     GENERATINGPOWERPC => CFMSYSTEMCALLS
  78.     CFMSYSTEMCALLS => GENERATINGCFM
  79.     GENERATINGPOWERPC => SystemSevenOrLater
  80.     SystemSevenFiveOrLater => SystemSevenOrLater
  81.     SystemSevenOrLater => SystemSixOrLater
  82.     
  83.     
  84. */
  85. #ifdef GENERATINGPOWERPC
  86. #define GENERATING68K !GENERATINGPOWERPC
  87. #endif
  88. #ifdef GENERATING68K
  89. #define GENERATINGPOWERPC !GENERATING68K
  90. #endif
  91. #ifndef GENERATINGPOWERPC
  92.     #if defined(powerc) || defined(__powerc)
  93. #define GENERATINGPOWERPC 1
  94.     #else
  95. #define GENERATINGPOWERPC 0
  96.     #endif
  97. #endif
  98. #ifndef GENERATING68K
  99.     #if GENERATINGPOWERPC
  100. #define GENERATING68K 0
  101.     #else
  102. #define GENERATING68K 1
  103.     #endif
  104. #endif
  105. #if GENERATING68K
  106.     #if defined(applec) || defined(__SC__)
  107.         #ifdef mc68881
  108. #define GENERATING68881 1
  109.         #endif
  110.     #elif __MWERKS__
  111.         #if __MC68881__
  112. #define GENERATING68881 01
  113.         #endif
  114.     #endif
  115. #endif
  116. #ifndef CGLUESUPPORTED
  117.     #if defined(THINK_C) 
  118. #define CGLUESUPPORTED 0
  119.     #else
  120. #define CGLUESUPPORTED 1
  121.     #endif
  122. #endif
  123. #ifndef GENERATING68881
  124. #define GENERATING68881 0
  125. #endif
  126. #if GENERATINGPOWERPC
  127. #define CFMSYSTEMCALLS 1
  128. #define GENERATINGCFM 1
  129. #endif
  130. #ifndef GENERATINGCFM
  131.     #ifndef __CFM68K__
  132. #define GENERATINGCFM 0
  133. #define CFMSYSTEMCALLS 0
  134.     #else
  135. #define GENERATINGCFM 1
  136. #define CFMSYSTEMCALLS 1
  137.     #endif
  138. #endif
  139. #ifndef CFMSYSTEMCALLS
  140. #define CFMSYSTEMCALLS 0
  141. #endif
  142. #ifndef SystemSevenFiveOrLater
  143. #define SystemSevenFiveOrLater 0
  144. #endif
  145. #ifndef OLDROUTINENAMES
  146. #define OLDROUTINENAMES 1
  147. #endif
  148. #ifndef OLDROUTINELOCATIONS
  149. #define OLDROUTINELOCATIONS 1
  150. #endif
  151. #ifndef SystemSevenOrLater
  152.     #if GENERATINGCFM || SystemSevenFiveOrLater
  153. #define SystemSevenOrLater 1
  154.     #else
  155. #define SystemSevenOrLater 0
  156.     #endif
  157. #endif
  158. #ifndef SystemSixOrLater
  159. #define SystemSixOrLater SystemSevenOrLater
  160. #endif
  161. #if OLDROUTINENAMES 
  162.     #ifndef USES68KINLINES
  163. #define USES68KINLINES GENERATING68K
  164.     #endif
  165. #define USESCODEFRAGMENTS GENERATINGCFM
  166. #define USESROUTINEDESCRIPTORS GENERATINGCFM
  167. #endif
  168. #if CFMSYSTEMCALLS
  169. #define ONEWORDINLINE(trapNum)
  170. #define TWOWORDINLINE(w1, w2)
  171. #define THREEWORDINLINE(w1, w2, w3)
  172. #define FOURWORDINLINE(w1, w2, w3, w4)
  173. #define FIVEWORDINLINE(w1, w2, w3, w4, w5)
  174. #define SIXWORDINLINE(w1, w2, w3, w4, w5, w6)
  175. #define SEVENWORDINLINE(w1, w2, w3, w4, w5, w6, w7)
  176. #define EIGHTWORDINLINE(w1, w2, w3, w4, w5, w6, w7, w8)
  177. #define NINEWORDINLINE(w1, w2, w3, w4, w5, w6, w7, w8, w9)
  178. #define TENWORDINLINE(w1, w2, w3, w4, w5, w6, w7, w8, w9, w10)
  179. #define ELEVENWORDINLINE(w1, w2, w3, w4, w5, w6, w7, w8, w9, w10, w11)
  180. #define TWELVEWORDINLINE(w1, w2, w3, w4, w5, w6, w7, w8, w9, w10, w11, w12)
  181. #else
  182. #define ONEWORDINLINE(trapNum)     \
  183.     = trapNum
  184. #define TWOWORDINLINE(w1, w2)     \
  185.     = {w1,w2}
  186. #define THREEWORDINLINE(w1, w2, w3)  \
  187.     = {w1,w2,w3}
  188. #define FOURWORDINLINE(w1, w2, w3, w4)  \
  189.     = {w1,w2,w3,w4}
  190. #define FIVEWORDINLINE(w1, w2, w3, w4, w5)  \
  191.     = {w1,w2,w3,w4,w5}
  192. #define SIXWORDINLINE(w1, w2, w3, w4, w5, w6)  \
  193.     = {w1,w2,w3,w4,w5,w6}
  194. #define SEVENWORDINLINE(w1, w2, w3, w4, w5, w6, w7)  \
  195.     = {w1,w2,w3,w4,w5,w6,w7}
  196. #define EIGHTWORDINLINE(w1, w2, w3, w4, w5, w6, w7, w8)  \
  197.     = {w1,w2,w3,w4,w5,w6,w7,w8}
  198. #define NINEWORDINLINE(w1, w2, w3, w4, w5, w6, w7, w8, w9)  \
  199.     = {w1,w2,w3,w4,w5,w6,w7,w8,w9}
  200. #define TENWORDINLINE(w1, w2, w3, w4, w5, w6, w7, w8, w9, w10)  \
  201.     = {w1,w2,w3,w4,w5,w6,w7,w8,w9,w10}
  202. #define ELEVENWORDINLINE(w1, w2, w3, w4, w5, w6, w7, w8, w9, w10, w11)  \
  203.     = {w1,w2,w3,w4,w5,w6,w7,w8,w9,w10,w11}
  204. #define TWELVEWORDINLINE(w1, w2, w3, w4, w5, w6, w7, w8, w9, w10, w11, w12)  \
  205.     = {w1,w2,w3,w4,w5,w6,w7,w8,w9,w10,w11,w12}
  206. #endif
  207.  
  208. #ifdef __CFM68K__
  209. #pragma lib_export off
  210. #endif
  211.  
  212.  
  213. #ifdef __cplusplus
  214. }
  215. #endif
  216.  
  217. #endif /* __CONDITIONALMACROS__ */
  218.